package com.cf.r1034;

import java.io.*;
import java.util.Arrays;

public class c {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StreamTokenizer in = new StreamTokenizer(br);
        PrintWriter out = new PrintWriter(System.out);
        in.nextToken(); int t = (int) in.nval;
        while (t-- > 0) {
            in.nextToken(); int n = (int) in.nval;
            int[] a = new int[n];
            int[] premin = new int[n];
            int[] houmax = new int[n];
            Arrays.fill(premin, Integer.MAX_VALUE);
            Arrays.fill(houmax, Integer.MIN_VALUE);
            for (int i = 0; i < n; i++) {
                in.nextToken(); a[i] = (int) in.nval;
            }
            premin[0] = a[0];
            for (int i = 1; i < n; i++) {
                premin[i] = Math.min(premin[i - 1], a[i]);
            }
            houmax[n - 1] = a[n - 1];
            for (int i = n - 2; i >= 0; i--) {
                houmax[i] = Math.max(houmax[i + 1], a[i]);
            }
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < n; i++) {
                if (premin[i] < a[i] && houmax[i] > a[i]) {
                    sb.append(0);
                } else {
                    sb.append(1);
                }
            }
            out.println(sb);
        }
        out.flush();
        out.close();
        br.close();
    }
}
